package multiplex.dataaccess.dao;

import java.sql.Connection;

import multiplex.dataaccess.ConnectionFactory;
import multiplex.dataaccess.DaoException;

public abstract class AbstractDao {
	
	private Connection connection;
	
	public AbstractDao() {
		try {
			this.connection = ConnectionFactory.getConnection();
		} catch (Exception e) {
			throw new DaoException();
		}
	}
	
	protected Connection getConnection(){ return connection; }
	
	@Override
	protected void finalize() throws Throwable {
		connection.close();
		super.finalize();
	}
	
}
